<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:17
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-02-27 12:01:40
 * ------------------------------------------------ *
 * 友情链接                                         *
 * ------------------------------------------------ */
namespace Admin\Model;

class FriendlinksModel extends CommonModel{

// 新增

	public function addFriendlinks(){
		$data = array();
		$data['friendlinkIco'] = I('friendlinkIco');
		$data['friendlinkName'] = I('friendlinkName');
		$data['friendlinkUrl'] = I('friendlinkUrl');
		$data['friendlinkSort'] = I('friendlinkSort',0);
		if($this->checkEmpty($data)){
			$m = M('friendlinks');
			$rs = $m->add($data);
			if(false !== $rs){
				return true;
			}
		}
		return flase;
	}

// 编辑

    public function editFriendlinks(){
		$m = M('friendlinks');
		$data = array();
		$data['friendlinkIco'] = I('friendlinkIco');
		$data['friendlinkName'] = I('friendlinkName');
		$data['friendlinkUrl'] = I('friendlinkUrl');
		$data['friendlinkSort'] = I('friendlinkSort',0);
		if($this->checkEmpty($data)){
			$rs = $m->where("friendlinkId=".(int)I('friendlinkId'))->save($data);
			if(false !== $rs){
				return true;
			}
		}
		return false;
	}

// 获取
	public function getFriendlinks(){
		$m = M('friendlinks');
		return $m->where("friendlinkId=".(int)I('id'))->find();
	}

// 删除

	public function delFriendlinks(){
		$m = M('friendlinks');
		$rs = $m->delete((int)I('id'));
		if(false !== $rs){
			return true;
		}
		return false;
	}
}